package com.yaorange.jxc.goods.controller;


import com.yaorange.jxc.goods.entity.Goods;
import com.yaorange.jxc.goods.entity.GoodsPageRequestResult;


import com.yaorange.jxc.goods.service.GoodsService1;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @description:
 * @company: yaorange
 * @author: wu YanZu
 * @version: 1.0
 * @create: 2022-04-28 14:28:11
 */
@RestController
@RequestMapping("/goods")
public class GoodsController1 {
    @Autowired
    private GoodsService1 goodsService;

    @PostMapping("/list")
    public Result<?> findGoodsListPage(@RequestBody GoodsPageRequestResult result){
        Map<String,Object> goodsMap = goodsService.selectGoodsListPage(result);
        List<Goods> goodsList = (List<Goods>)goodsMap.get("商品列表");
        if(goodsList.size() == 0){
            return Result.error(400,"查询失败");
        }
        return Result.OK(goodsMap);
    }
}
